package net.gazhi.delonix.core.init;

import net.gazhi.delonix.core.jpa.AbstractJpaService;

public abstract class AbstractInitService extends AbstractJpaService implements InitService, Comparable<InitService> {

	private boolean finished = false;

	@Override
	public int getPriority() {
		return 5;
	}

	@Override
	public void setFinished() {
		this.finished = true;
	}

	public boolean isFinished() {
		return this.finished;
	}

	@Override
	public int compareTo(InitService target) {
		int i = Integer.compare(this.getPriority(), target.getPriority());
		return i == 0 ? this.getClass().getName().compareTo(target.getClass().getName()) : i;
	}

}
